﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;

namespace Tayninh2011
{
    public partial class Form2 : Form
    {
        private string[] _strLayerNames = { "tn_duong", "tn_hem", "tn_thua" };
        private IWorkspaceEdit _sdeWorkspaceEdit;

        public IWorkspaceEdit SdeWorkspaceEdit
        {
            get { return _sdeWorkspaceEdit; }
            set { _sdeWorkspaceEdit = value; }
        }
        private string _sdeEnvironment = "";

        public string SdeEnvironment
        {
            get { return _sdeEnvironment; }
            set { _sdeEnvironment = value; }
        }
        private FrmMain frmMain = FrmMain.FormMain;
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            ITnToolsWorkspace workspaceTool = new TnTools();
            IFeatureClass fc;
            IFeatureLayer fl;
            for (int i = 0; i < this._strLayerNames.Length; i++)
            {
                fc = workspaceTool.OpenFeatureClassFromSDE(this._sdeWorkspaceEdit, this._strLayerNames[i]);
                fl = new FeatureLayerClass();
                fl.FeatureClass = fc;
                ILayer layer = (ILayer)fl;
                layer.Name = fc.AliasName;
                axMapControl1.AddLayer(layer);
            }

            axMapControl1.Map.Name = "Các lớp bản đồ";
            axMapControl1.ActiveView.Refresh();
        }
    }
}
